3.81 \(\int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx\)

Optimal. Leaf size=119 \[ \frac {\sin ^2(c+d x) \left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right )}{2 d}+\frac {1}{2} x \left (a^4+6 a^2 b^2-3 b^4\right )-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {b^4 \tan (c+d x)}{d} \]

[Out]

1/2*(a^4+6*a^2*b^2-3*b^4)*x-4*a*b^3*ln(sin(d*x+c))/d+4*a*b^3*ln(tan(d*x+c))/d+1/2*(4*a*b*(a^2-b^2)+(a^4-6*a^2*
b^2+b^4)*cot(d*x+c))*sin(d*x+c)^2/d+b^4*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.18, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3088, 1805, 1802, 635, 203, 260} \[ \frac {\sin ^2(c+d x) \left (\left (-6 a^2 b^2+a^4+b^4\right ) \cot (c+d x)+4 a b \left (a^2-b^2\right )\right )}{2 d}+\frac {1}{2} x \left (6 a^2 b^2+a^4-3 b^4\right )-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {b^4 \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^4,x]

[Out]

((a^4 + 6*a^2*b^2 - 3*b^4)*x)/2 - (4*a*b^3*Log[Sin[c + d*x]])/d + (4*a*b^3*Log[Tan[c + d*x]])/d + ((4*a*b*(a^2
 - b^2) + (a^4 - 6*a^2*b^2 + b^4)*Cot[c + d*x])*Sin[c + d*x]^2)/(2*d) + (b^4*Tan[c + d*x])/d

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 1802

Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*Pq*(a + b*x
^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 1805

Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[(c*x)^m*Pq,
 a + b*x^2, x], f = Coeff[PolynomialRemainder[(c*x)^m*Pq, a + b*x^2, x], x, 0], g = Coeff[PolynomialRemainder[
(c*x)^m*Pq, a + b*x^2, x], x, 1]}, Simp[((a*g - b*f*x)*(a + b*x^2)^(p + 1))/(2*a*b*(p + 1)), x] + Dist[1/(2*a*
(p + 1)), Int[(c*x)^m*(a + b*x^2)^(p + 1)*ExpandToSum[(2*a*(p + 1)*Q)/(c*x)^m + (f*(2*p + 3))/(c*x)^m, x], x],
 x]] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && LtQ[p, -1] && ILtQ[m, 0]

Rule 3088

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> -Dist[d^(-1), Subst[Int[(x^m*(b + a*x)^n)/(1 + x^2)^((m + n + 2)/2), x], x, Cot[c + d*x]], x] /; FreeQ[
{a, b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[n, 0] && GtQ[m, 1])

Rubi steps

\begin {align*} \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx &=-\frac {\operatorname {Subst}\left (\int \frac {(b+a x)^4}{x^2 \left (1+x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\operatorname {Subst}\left (\int \frac {-2 b^4-8 a b^3 x-\left (a^4+6 a^2 b^2-b^4\right ) x^2}{x^2 \left (1+x^2\right )} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\operatorname {Subst}\left (\int \left (-\frac {2 b^4}{x^2}-\frac {8 a b^3}{x}+\frac {-a^4-6 a^2 b^2+3 b^4+8 a b^3 x}{1+x^2}\right ) \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}+\frac {\operatorname {Subst}\left (\int \frac {-a^4-6 a^2 b^2+3 b^4+8 a b^3 x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}+\frac {\left (4 a b^3\right ) \operatorname {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{d}-\frac {\left (a^4+6 a^2 b^2-3 b^4\right ) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {1}{2} \left (a^4+6 a^2 b^2-3 b^4\right ) x-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 6.26, size = 477, normalized size = 4.01 \[ \frac {b^3 \left (\frac {\cos ^2(c+d x) (a+b \tan (c+d x))^5 \left (a b \tan (c+d x)+b^2\right )}{2 b^4 \left (a^2+b^2\right )}-\frac {\left (3 b^2-5 a^2\right ) \left (b \left (6 a^2-b^2\right ) \tan (c+d x)+\frac {1}{2} \left (\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}+4 a (a-b) (a+b)\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (4 a (a-b) (a+b)-\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+2 a b^2 \tan ^2(c+d x)+\frac {1}{3} b^3 \tan ^3(c+d x)\right )+4 a \left (\frac {1}{2} b^2 \left (10 a^2-b^2\right ) \tan ^2(c+d x)+5 a b \left (2 a^2-b^2\right ) \tan (c+d x)+\frac {1}{2} \left (5 a^4-10 a^2 b^2+\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}+b^4\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (5 a^4-10 a^2 b^2-\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}+b^4\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+\frac {5}{3} a b^3 \tan ^3(c+d x)+\frac {1}{4} b^4 \tan ^4(c+d x)\right )}{2 b^2 \left (a^2+b^2\right )}\right )}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^4,x]

[Out]

(b^3*((Cos[c + d*x]^2*(a + b*Tan[c + d*x])^5*(b^2 + a*b*Tan[c + d*x]))/(2*b^4*(a^2 + b^2)) - ((-5*a^2 + 3*b^2)
*(((4*a*(a - b)*(a + b) + (a^4 - 6*a^2*b^2 + b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] - b*Tan[c + d*x]])/2 + ((4*a*(a -
 b)*(a + b) - (a^4 - 6*a^2*b^2 + b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] + b*Tan[c + d*x]])/2 + b*(6*a^2 - b^2)*Tan[c
+ d*x] + 2*a*b^2*Tan[c + d*x]^2 + (b^3*Tan[c + d*x]^3)/3) + 4*a*(((5*a^4 - 10*a^2*b^2 + b^4 + (a^5 - 10*a^3*b^
2 + 5*a*b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] - b*Tan[c + d*x]])/2 + ((5*a^4 - 10*a^2*b^2 + b^4 - (a^5 - 10*a^3*b^2
+ 5*a*b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] + b*Tan[c + d*x]])/2 + 5*a*b*(2*a^2 - b^2)*Tan[c + d*x] + (b^2*(10*a^2 -
 b^2)*Tan[c + d*x]^2)/2 + (5*a*b^3*Tan[c + d*x]^3)/3 + (b^4*Tan[c + d*x]^4)/4))/(2*b^2*(a^2 + b^2))))/d

________________________________________________________________________________________

fricas [A]  time = 0.83, size = 136, normalized size = 1.14 \[ -\frac {8 \, a b^{3} \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + 4 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right )^{3} - {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} d x\right )} \cos \left (d x + c\right ) - {\left (2 \, b^{4} + {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x, algorithm="fricas")

[Out]

-1/2*(8*a*b^3*cos(d*x + c)*log(-cos(d*x + c)) + 4*(a^3*b - a*b^3)*cos(d*x + c)^3 - (2*a^3*b - 2*a*b^3 + (a^4 +
 6*a^2*b^2 - 3*b^4)*d*x)*cos(d*x + c) - (2*b^4 + (a^4 - 6*a^2*b^2 + b^4)*cos(d*x + c)^2)*sin(d*x + c))/(d*cos(
d*x + c))

________________________________________________________________________________________

giac [A]  time = 3.52, size = 128, normalized size = 1.08 \[ \frac {4 \, a b^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, b^{4} \tan \left (d x + c\right ) + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} {\left (d x + c\right )} - \frac {4 \, a b^{3} \tan \left (d x + c\right )^{2} - a^{4} \tan \left (d x + c\right ) + 6 \, a^{2} b^{2} \tan \left (d x + c\right ) - b^{4} \tan \left (d x + c\right ) + 4 \, a^{3} b}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x, algorithm="giac")

[Out]

1/2*(4*a*b^3*log(tan(d*x + c)^2 + 1) + 2*b^4*tan(d*x + c) + (a^4 + 6*a^2*b^2 - 3*b^4)*(d*x + c) - (4*a*b^3*tan
(d*x + c)^2 - a^4*tan(d*x + c) + 6*a^2*b^2*tan(d*x + c) - b^4*tan(d*x + c) + 4*a^3*b)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

maple [A]  time = 52.30, size = 210, normalized size = 1.76 \[ \frac {a^{4} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{2 d}+\frac {a^{4} x}{2}+\frac {a^{4} c}{2 d}-\frac {2 \left (\cos ^{2}\left (d x +c \right )\right ) a^{3} b}{d}-\frac {3 a^{2} b^{2} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{d}+3 a^{2} b^{2} x +\frac {3 a^{2} b^{2} c}{d}-\frac {2 a \,b^{3} \left (\sin ^{2}\left (d x +c \right )\right )}{d}-\frac {4 a \,b^{3} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {b^{4} \left (\sin ^{5}\left (d x +c \right )\right )}{d \cos \left (d x +c \right )}+\frac {b^{4} \cos \left (d x +c \right ) \left (\sin ^{3}\left (d x +c \right )\right )}{d}+\frac {3 b^{4} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{2 d}-\frac {3 b^{4} x}{2}-\frac {3 b^{4} c}{2 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x)

[Out]

1/2*a^4*cos(d*x+c)*sin(d*x+c)/d+1/2*a^4*x+1/2/d*a^4*c-2/d*cos(d*x+c)^2*a^3*b-3*a^2*b^2*cos(d*x+c)*sin(d*x+c)/d
+3*a^2*b^2*x+3/d*a^2*b^2*c-2/d*a*b^3*sin(d*x+c)^2-4*a*b^3*ln(cos(d*x+c))/d+1/d*b^4*sin(d*x+c)^5/cos(d*x+c)+1/d
*b^4*cos(d*x+c)*sin(d*x+c)^3+3/2*b^4*cos(d*x+c)*sin(d*x+c)/d-3/2*b^4*x-3/2/d*b^4*c

________________________________________________________________________________________

maxima [A]  time = 0.44, size = 135, normalized size = 1.13 \[ \frac {8 \, a^{3} b \sin \left (d x + c\right )^{2} + {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{4} + 6 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} b^{2} - 8 \, {\left (\sin \left (d x + c\right )^{2} + \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )} a b^{3} - 2 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} b^{4}}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x, algorithm="maxima")

[Out]

1/4*(8*a^3*b*sin(d*x + c)^2 + (2*d*x + 2*c + sin(2*d*x + 2*c))*a^4 + 6*(2*d*x + 2*c - sin(2*d*x + 2*c))*a^2*b^
2 - 8*(sin(d*x + c)^2 + log(sin(d*x + c)^2 - 1))*a*b^3 - 2*(3*d*x + 3*c - tan(d*x + c)/(tan(d*x + c)^2 + 1) -
2*tan(d*x + c))*b^4)/d

________________________________________________________________________________________

mupad [B]  time = 1.23, size = 255, normalized size = 2.14 \[ \frac {a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-3\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+4\,a\,b^3\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )+6\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-4\,a\,b^3\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )}{d}+\frac {\frac {a^4\,\sin \left (c+d\,x\right )}{8}+\frac {9\,b^4\,\sin \left (c+d\,x\right )}{8}+\frac {a^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {b^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {a\,b^3\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {a^3\,b\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {3\,a^2\,b^2\,\sin \left (c+d\,x\right )}{4}-\frac {3\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}}{d\,\cos \left (c+d\,x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*cos(c + d*x) + b*sin(c + d*x))^4/cos(c + d*x)^2,x)

[Out]

(a^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) - 3*b^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) + 4*a*b^3
*log(1/cos(c/2 + (d*x)/2)^2) + 6*a^2*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) - 4*a*b^3*log(cos(c + d*x
)/(cos(c + d*x) + 1)))/d + ((a^4*sin(c + d*x))/8 + (9*b^4*sin(c + d*x))/8 + (a^4*sin(3*c + 3*d*x))/8 + (b^4*si
n(3*c + 3*d*x))/8 + (a*b^3*cos(3*c + 3*d*x))/2 - (a^3*b*cos(3*c + 3*d*x))/2 - (3*a^2*b^2*sin(c + d*x))/4 - (3*
a^2*b^2*sin(3*c + 3*d*x))/4)/(d*cos(c + d*x))

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)**2*(a*cos(d*x+c)+b*sin(d*x+c))**4,x)

[Out]

Timed out

________________________________________________________________________________________